Welcome to python!

3.06 选择结构练习(2)

煎饼果子金额计算:

小份 5元;中份 6元;大份7元;

用户选择配料:

鸡蛋 2元;疏菜 1元;叉烧 3元;

优惠:

如果满10元,送一杯豆浆


type=int(input("你要什么类型的煎饼(1、小份 2、中份 3、大份):"))

mixture=int(input("你要什么配菜:"))

num=int(input("你需要买几份煎饼果子:"))

amount=0

if type==1:

amount=amount+5

elif type==2:

amount=amount+6

elif type==3:

amount=amount+7

else:

print("输入错误,请重新选择类型")

if mixture==1:

amount=amount+2

elif mixture==2:

amount=amount+1

elif mixture==3:

amount=amount+3

else:

print("输入错误,请重新选择类型")

amount=amount*num

print("您的订单总金额为",amount,"元!")

if amount>10:

print("您的购买价格满10元,可以送一杯豆浆")

返回值:

你要什么类型的煎饼(1、小份 2、中份 3、大份):1

你要什么配菜:3

你需要买几份煎饼果子:3

您的订单总金额为 24 元!

您的购买价格满10元,可以送一杯豆浆